<!DOCTYPE html>
<!-- saved from url=(0081)http://per.cjmzvip.com/merchant/regHtml?agentNo=525319&userCode=M1055&regisType=2 -->
<html lang="zh_CN" style="background: #fff"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Expires" content="0">
	<title>注册</title>
	<link rel="stylesheet" type="text/css" href="/web/user/css/style.css">
	<link rel="stylesheet" type="text/css" href="/web/user/css/normalize.css">
</head>
<body>
<div class="container">
	<div class="bgimg"><img src="/web/user/images/banner@2x.jpg"></div>
	<div class="reg_box reginpt">
		<from name="form" id="from">
			<div class="fadeInLeft">

				<div class="row_1">
					<b><img src="/web/user/images/user_2x.png"></b>
					<input placeholder="请输入手机号码" type="text" maxlength="11" name="mobile" id="mobile">
				</div>

				<div class="row_1">
					<b><img src="/web/user/images/Lock@2x.png"></b>
					<input placeholder="请输入注册密码" type="password" name="password" id="password">
				</div>

				<div class="row_1">
					<b><img src="/web/user/images/people_2x.png"></b>
					<input placeholder="请输入邀请码" type="text" name="invited_code" id="invited_code" value="{{ $invitedCode }}">
				</div>

				<div class="row_1">
					<b><img src="/web/user/images/check_2x.png"></b>
					<input placeholder="请输入短信验证码" type="text" name="code" id="code">
					<div class="getcode-con">
						<button id="getcode" href="javascript:;" class="reg_code" >获取验证码</button>
						<button href="javascript:;" class="reg_code2"><i>60</i>秒重发</button>
					</div>
				</div>
				<!--	-->
				<div class="row_2"><div class="tgn-c"><i class="active"></i><span>我同意
				<a href="{{ $appUrl }}/user/privacy_agreement">《龙猫管家协议》</a></span></div></div>

				<div class="row_3">
					<a href="javascript:;" class="reg_btn" id="reg_btn">立即注册</a>
				</div>

				<div class="row_4">已注册，请点击下载
					<a href="{{ $appUrl }}/channel_qrcode/download_app">龙猫管家APP</a>
				</div>
				
			</div>
		</from>
	</div>
</div>

<script type="text/javascript" src="/web/user/js/zepto.min.js"></script>
<script type="text/javascript" src="/web/user/js/getcode.js"></script>
<script type="text/javascript" src="/web/user/js/md5.js"></script>
<script type="text/javascript" src="/web/user/js/jsencrypt.min.js"></script>
<script type="text/javascript" src="/web/user/js/alert.js"></script>

<script type="text/javascript">
    function smscallback(data){

    }
    function regcallback(data){

    }
    var keyno;
    function getcodimg(){
        keyno = 'xxxxxxx4xxxxx5xxyxxxxxxxyxxxxxxx'.replace(/[xy]/g, function(c) {
            var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
            return v.toString(16);
        });
        var codeimg = 'http://per.cjmzvip.com/checkCode/getImageCheckCode?imageCodekey=' + keyno;
        $(".codeig img").attr("src", codeimg);
    }
    getcodimg();
    $(".codeig").click(function(){
        getcodimg();
    });
    function getUrlParam(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r!=null) return unescape(r[2]); return null;
    }
    $('#getcode').click(function(){

        if($("#mobile").val()==""){
            $.alert("手机号不能为空");
        }else if($("#codeimg").val()==""){
            $.alert("图形码不能为空");
        } else {
            $('.reg_code').hide();
            $('.reg_code2 i').html('60');
            $('.reg_code2').show();
            var second = 60;
            var timer = null;
            timer = setInterval(function(){
                second -= 1;
                if(second >0 ){
                    $('.reg_code2 i').html(second);
                }else{
                    clearInterval(timer);
                    $('.reg_code').show();
                    $('.reg_code').html("重新获取");
                    $('.reg_code2').hide();
                }
            },1000);
            $.ajax({
                headers: {
                    'Accept': "application/json; charset=utf-8",
                    'Api-Version-Number': "v1.9.1"
                },
                type : "POST",
                url : '{{ $appUrl }}' + '/api/user/verification_codes',
                data : {
                    mobile:$("#mobile").val().trim(),
                    type:'register'
                },
                success: function(data) {
                    if (0 !== data.code) {
                        $.alert(data.message);
                        getcodimg();
                        clearInterval(timer);
                        $('.reg_code').show();
                        $('.reg_code').html("重新获取");
                        $('.reg_code2').hide();
                    }
                },
                error: function(XMLHttpRequest) {
                    $.alert("网络异常,请稍后再试！");
                }
            });
        }
    });

    $("#mobile,#codeimg").on("keyup",function() {
        if($("#mobile").val().length==11 && $("#codeimg").val().length==4) {
            $(".reg_code").addClass("lgcolor");
        } else if($("#mobile").val().length<11 || $("#codeimg").val().length<4) {
            $(".reg_code").removeClass("lgcolor");
        }
    });

    $(".row_2 i").click(function(){
        $(this).toggleClass("active");
    });

    $("#reg_btn").click(function(){
        if($(".reg_btn").html() == '注册中') {
            return;
        }
        if($("#mobile").val()=="") {
            $.alert("手机号不能为空！");
            return false;
        }
        if($("#password").val()=="") {
            $.alert("密码不能为空！");
            return false;
        }
        if($('input[name="password"]').val().trim().length < 6){
            $.alert('密码不能低于6位');
            return false;
        }
        if($('input[name="password"]').val().trim().length > 18){
            $.alert('密码不能大于18位');
            return false;
        }
        if($('input[name="invited_code"]').val().trim() == ''){
            $.alert('推荐人ID不能为空');
            return false;
        }
        if($("#code").val()=="") {
            $.alert("验证码不能为空！");
            return false;
        }
        if(!$(".row_2 i").hasClass('active')){
            $.alert("您未同意《龙猫管家协议》");
            return false;
        }
        $(".reg_btn").html("注册中");
        $.ajax({
            headers: {
                'Accept': "application/json; charset=utf-8",
                'Api-Version-Number': "v1.9.1"
            },
            type : "POST",
            url : '{{ $appUrl }}' + '/api/user/register',
            data : {
                mobile:$('input[name="mobile"]').val().trim(),
                password:$('input[name="password"]').val().trim(),
                password_confirmation:$('input[name="password"]').val().trim(),
                invited_code:$('input[name="invited_code"]').val().trim(),
                verification_code:$('input[name="code"]').val().trim(),
                is_agree:'yes'
            },
            success: function(data){
                if (0 == data.code) {
                    $.alert("注册完成！",function(){
                        window.location.href = '{{ $appUrl }}' + '/channel_qrcode/download_app';
                    });
                } else {
                    $.alert(data.message);
                    $(".reg_btn").html("立即注册");
                }
            },
            error: function() {
                $.alert("网络异常,请稍后再试！");
                $(".reg_btn").html("立即注册");
            }
        });

    })
</script>
</body></html>